﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using HROReporting.Infrastructure.CookieStorage;
using HROReporting.Infrastructure.Authentication;
using HROReporting.Services.Interfaces;
using HROReporting.Controllers.ViewModels.Test;
using HROReporting.Services.Messaging.StudentService;
using HROReporting.Services.Messaging.DocentIncheckingService;
using HROReporting.Services.Messaging.NFCDeviceService;
using HROReporting.Services.Messaging.PresentieIncheckingService;

namespace HROReporting.Controllers.Controllers
{
    public class TestController : BaseController
    {
        private IFormsAuthentication _formsAuthentication;
        private IDocentIncheckingService _docentIncheckingService;
        private INFCDeviceService _nfcDeviceService;
        private  IPresentieIncheckingService _presentieIncheckingService;

        public TestController(ICookieStorageService cookieStorageService,
                              IFormsAuthentication formsAuthentication,
                              IDocentIncheckingService docentIncheckingService,
                              INFCDeviceService nfcDeviceService,
                              IPresentieIncheckingService presentieIncheckingService  )
            : base(cookieStorageService)
        {
            _formsAuthentication = formsAuthentication;
            _docentIncheckingService = docentIncheckingService;
            _nfcDeviceService = nfcDeviceService;
            _presentieIncheckingService = presentieIncheckingService;
        }

        [Authorize]
        public ActionResult Index()
        {
            GetPresentielijstenBySerialRequest serialRequest = new GetPresentielijstenBySerialRequest();
            serialRequest.serial = "114-557-215-903";

            GetPresentielijstenBySerialResponse serialResponse = new GetPresentielijstenBySerialResponse();
            serialResponse.Presentielijsten = _presentieIncheckingService.GetPresentielijstenBySerial(serialRequest).Presentielijsten;

            CreatePresentieIncheckingRequest presentieRequest = new CreatePresentieIncheckingRequest();
            presentieRequest.Studentnummer = "0850909";
            presentieRequest.Presentielijsten = serialResponse.Presentielijsten;

            _presentieIncheckingService.CreateInchecking(presentieRequest);

            return View();
        }
    }
}
